const Mock = require('mockjs')
// 分类分析
const subitem = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        code: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //能耗代码
        nenghao_name: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //能耗名称
        type: '@upper()@string("number", 4)',    //能耗类型
        superiors: '@upper()@string("number", 4)',   //上级能耗
        unit: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //能耗单位
        standard_coal: '@upper()@string("number", 4)',    //转换标准煤系数
    }]
});
// 设备协议
const eagreement = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        type: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
        manufacturer: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备厂家
        model: '@upper()@string("number", 4)',    //设备型号
        agreement: '@upper()@string("number", 4)',   //设备协议
    }]
});

// 风盘功率
const fanCoil = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        model:'@upper()@string("number", 4)',    //风盘型号
        manufacturer: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //风盘厂家
        cold_high: '@integer(10, 999)',    //制冷高档功率
        cold_middle: '@integer(10, 999)',   //制冷中档功率
        cold_low: '@integer(10, 999)',    //制冷低档功率
        warm_high: '@integer(10, 999)',   //采暖高档功率
        warm_middle: '@integer(10, 999)',    //采暖中档功率
        warm_low: '@integer(10, 999)',   //采暖低档功率
    }]
});
// 设备标签
const elabel = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        type: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
    
        tag: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备标签
    
        name: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //系统识别号名称
    
    }]
});
// 设备分析
const feanalyze = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        type: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
    
        name: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //分析名称
    
        argument: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //对应参数
    
    }]
});


module.exports = [
    // 分类分析
    {
        url: '/vue-admin-template/end/subitem',
        type: 'get',
        response: config => {
            const items = subitem.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 设备协议
    {
        url: '/vue-admin-template/end/eagreement',
        type: 'get',
        response: config => {
            const items = eagreement.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 风盘功率
    {
        url: '/vue-admin-template/end/fanCoil',
        type: 'get',
        response: config => {
            const items = fanCoil.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 设备标签
    {
        url: '/vue-admin-template/end/elabel',
        type: 'get',
        response: config => {
            const items = elabel.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 设备分析
    {
        url: '/vue-admin-template/end/feanalyze',
        type: 'get',
        response: config => {
            const items = feanalyze.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
]